using System;
using System.BusinessObjects.Data;
using Iesi.Collections.Generic;
using System.Xml.Serialization;
using Blazing.BusinessObjects.Tagging;
using Blazing.BusinessObjects.Widgets;

namespace Blazing.BusinessObjects.Cms
{
    [Serializable]
    public class Site : DataObject<Site>
    {
        #region Properties

        public virtual int ID
        {
            get { return GetValue<int>("ID"); }
            set
            {
                BeginEdit();
                SetValue("ID", value);
            }
        }

        public virtual string Name
        {
            get { return GetValue<string>("Name"); }
            set
            {
                BeginEdit();
                SetValue("Name", value);
            }
        }

        public virtual string Url
        {
            get { return GetValue<string>("Url"); }
            set
            {
                BeginEdit();
                SetValue("Url", value);
            }
        }

        [NonSerialized]
        Contentpage _contentPage;
        [XmlElement]
        public virtual Contentpage LoginPage
        {
            get
            {
                return _contentPage;
            }
            set
            {
                BeginEdit();
                _contentPage = value;
            }
        }

        [NonSerialized]
        private ISet<TaxonomyTag> _siteTaxonomyTags = new HashedSet<TaxonomyTag>();
        public virtual ISet<TaxonomyTag> SiteTaxonomyTags
        {
            get
            { return _siteTaxonomyTags; }
            set
            {
                BeginEdit();
                _siteTaxonomyTags = value;
            }
        }

        [NonSerialized]
        private ISet<Widget> _siteWidgets = new HashedSet<Widget>();
        public virtual ISet<Widget> SiteWidgets
        {
            get
            { return _siteWidgets; }
            set
            {
                BeginEdit();
                _siteWidgets = value;
            }
        }

        public virtual bool IsLoginRequired
        {
            get { return GetValue<bool>("IsLoginRequired"); }
            set
            {
                BeginEdit();
                SetValue("IsLoginRequired", value);
            }
        }

        public virtual DateTime RowStamp
        {
            get { return GetValue<DateTime>("RowStamp"); }
            set
            {
                SetValue("RowStamp", value);
            }
        }

        [NonSerialized]
        private ISet<Masterpage> _masterpages = new HashedSet<Masterpage>();
        [XmlIgnore]
        public virtual ISet<Masterpage> Masterpages
        {
            get 
            { return _masterpages; 
            }
            set {
                BeginEdit(); _masterpages = value;
            }
        }

        [NonSerialized]
        private ISet<Contentpage> _pages = new HashedSet<Contentpage>();
        [XmlIgnore]
        public virtual ISet<Contentpage> Pages
        {
            get{ return _pages; }
            set { BeginEdit(); _pages = value; }
        }

        [NonSerialized]
        private ISet<Menu> _menus = new HashedSet<Menu>();
        [XmlIgnore]
        public virtual ISet<Menu> Menus
        {
            get { return _menus; }
            set { BeginEdit(); _menus = value; }
        }

        private ISet<SiteAlias> _siteAliases = new HashedSet<SiteAlias>();
        public virtual ISet<SiteAlias> Aliases
        {
            get { return _siteAliases; }
            set { BeginEdit(); _siteAliases = value; }
        }

        #endregion
 
    }
}
